<?xml version="1.0" encoding="ISO-8859-1" ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" template="/pageUtils/template.xhtml">

	<ui:define name="body">
		<h:form prependId="false">
			<div align="left">
				<p:messages id="messages" autoUpdate="true" />
				<p:panel header="Cadastro de Pastor" style="whidt:800px;">
					<h:panelGrid columns="1" id="painel" width="100%">

						<h:outputText value="Nome :" style="width:100" />
						<p:inputText id="nome" style="width:400px;"
							value="#{pastorController.pastor.nome}" maxlength="60"
							title="informe o nome do pastor" />
						<p:tooltip for="nome" showEvent="focus" hideEvent="blur" />

					</h:panelGrid>
				</p:panel>
				<p:toolbar align="center">
					<p:toolbarGroup align="center">
						<p:commandButton value="Salvar" icon="ui-icon-disk" 
							action="#{pastorController.save()}" update="painelLista" />

						<p:commandButton value="Novo" icon="ui-icon-document"
							action="#{pastorController.clean()}" update="painel,messages" />

						<p:commandButton value="Imprimir" icon="ui-icon-print"
							ajax="false" action="#{pastorController.print()}">
						</p:commandButton>
					</p:toolbarGroup>
				</p:toolbar>

				<h:panelGrid id="painelLista" columns="1" style="width:100%;">
					<p:dataTable id="tableLista" var="listPastores"
						value="#{pastorController.pastores}" paginator="true" rows="5"
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="5,10,15" emptyMessage="Nenhum registro.">

						<p:column width="20">
							<f:facet name="header" width="20">
								<h:outputText value="Codigo" />
							</f:facet>
							<h:outputText value="#{listPastores.id}" />
						</p:column>

						<p:column width="300">
							<f:facet name="header">
								<h:outputText value="Nome" width="300" />
							</f:facet>
							<h:outputText value="#{listPastores.nome}" />
						</p:column>

						<p:column width="15">
							<p:commandButton title="Editar" update="painel"
								action="#{pastorController.editar()}" ajax="false"
								icon="ui-icon-folder-open">
								<f:setPropertyActionListener
									target="#{pastorController.selected}" value="#{listPastores}" />
							</p:commandButton>
						</p:column>

						<p:column width="15">
							<p:commandButton title="Deletar" update="tableLista"
								immediate="true" ajax="false"
								action="#{pastorController.remove()}" icon="ui-icon-trash">
								<f:setPropertyActionListener
									target="#{pastorController.selected}" value="#{listPastores}" />
							</p:commandButton>
						</p:column>

					</p:dataTable>
				</h:panelGrid>

			</div>
		</h:form>
	</ui:define>
</ui:composition>